package com.itheima.tcpdemo01;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class TcpServerSocket {
    public static void main(String[] args) throws IOException {
        //服务端 接收 客服端发送的数据

        ServerSocket ss = new ServerSocket(10001);

        //等待接收
        Socket accept = ss.accept();

        InputStream stream = accept.getInputStream();

        int len;
        while ((len = stream.read()) != -1) {
            System.out.println((char) len);
        }
        stream.close();
        ss.close();

    }
}
